<template>
	
		<u-dropdown ref='dropdown' :border-bottom="true" @open="open" @close="close" >
			<view v-for="(item,index) in nav" :key="index">
				<u-dropdown-item   v-model="item.title"  :title="item.title" :options="item.options" @change="change" height="400" >
				</u-dropdown-item>
			</view>
		</u-dropdown>

</template>

<script>
	export default {

		data() {
			return {
				nav: [],
				current: '',
			
			}
		},
		mounted() {
			
		},

		methods: {
			change(e) {	
				// var obj = this.nav[this.current].options.filter(item => item.enName == e)[0];
				// var label = this.nav[this.current].options.filter(item => item.enName == e)[0].label;
				// this.nav[this.current].title = label.length>4?label.slice(0, 4)+"...":label;
			     var obj = this.nav[this.current].options.filter(item => item.cateName == e)[0];
				 
				this.nav.forEach((item,index)=>{
					
					if(index==this.current){
						item.obj=obj
					}
				})
			    this.$emit("updata")
			},
			open(e) {

				this.current = e

			},
			navChange(e){
				// 清空菜单栏防止出现数据异常
		     	this.$refs.dropdown.menuList=[];
				this.$refs.dropdown.children=[];
				
				setTimeout(()=>{
					this.nav = []
					this.$nextTick(() => {
						this.nav=e;
					})
				},500)
			},
			close(e) {
                
				// this.current = ""

			},
		
		}
	}
</script>

<style>
</style>
